import { getParser } from '../src/test-parser';
import { PytestParser } from '../src/parsers/python-pytest/pytest-parser';
import {JavaJUnitParser} from '../src/parsers/java-junit/java-junit-parser'
import {MochaParser} from '../src/parsers/node/mocha-parser'
import {GolangTestParser} from '../src/parsers/golang-test/golang-test-parser'
import {expect} from 'chai'


describe('getParser', () => {
  it('should return JavaJUnitParser for Java-JUnit reporter', () => {
    const parser = getParser('Java-JUnit');
    expect(parser).to.be.instanceOf(JavaJUnitParser);
  });

  it('should return MochaParser for Node.js-Mocha reporter', () => {
    const parser = getParser('Node.js-Mocha');
    expect(parser).to.be.instanceOf(MochaParser);
  });

  it('should return GolangTestParser for Golang-Test reporter', () => {
    const parser = getParser('Golang-Test');
    expect(parser).to.be.instanceOf(GolangTestParser);
  });

  it('should return PytestParser for Python-Pytest reporter', () => {
    const parser = getParser('Python-Pytest');
    expect(parser).to.be.instanceOf(PytestParser);
  });

  it('should throw an error for an invalid reporter', () => {
    expect(() => getParser('Invalid-Reporter')).to.throw("Input variable 'reporter' is set to invalid value 'Invalid-Reporter'");
  });
});
